package com.zx.idc.backend.gui.api.commom.factory.encrypt;

import com.zx.idc.common.util.AESPkcs7;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * AES加密解密实现类
 * Created by hasee on 2019/2/20.
 */
public class AESEncryptionImpl implements Encrypt {

    private final static Logger LOG = LoggerFactory.getLogger(AESEncryptionImpl.class);



    @Override
    public byte[] decrypt(String encryptData, String password, String offset, boolean isBase64Encode) {
        try {
            return AESPkcs7.decrypt(encryptData, password, offset);
        } catch (Exception e) {
            LOG.error("解密出错：", e);
            return null;
        }
    }

    @Override
    public String encrypt(byte[] bytes, String ps, String offset, boolean isBase64Encode) {
        try {
            return AESPkcs7.encrypt(bytes, ps, offset);
        } catch (Exception e) {
            LOG.error("加密出错：", e);
            return null;
        }
    }

}
